package com.hos.net.res;


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hos.utile.JsonUtile;

import java.util.List;

/**
 * 返回基类
 * Created by Administrator on 2018/8/23 0023.
 */
public class BaseResponse<T> {
    public String code;
    public T obj;
    public List<T> list;
    public String msg;
    //返回的页面
    public PageData pageData;
    //通行令牌
    public String token;

    @JsonIgnore
    public String toJson() {
        String json = JsonUtile.obj2Json(this);
        return json;
    }

    @JsonIgnore
    public String toJson(String msg) {
        this.msg = msg;
        return toJson();
    }

    @JsonIgnore
    public String toJson(String code, String msg) {
        this.msg = msg;
        this.code = code;
        return toJson();
    }
}
